package com.xiaodu.yaml.properties;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.Date;
import java.util.Map;

/**
 * @author: dutianjie
 * @date: 2021/3/22
 * @version: v1.0.0
 * @description: 描述
 **/
@Component
public class User2Properties {

    @Value("${person.name:xiaodu}")
    private String name;

    @Value("${person.age}")
    private Integer age;

//    @Value("#{'${person.hobby}'.split(',')}")
    private String[] hobbys;

    @Value("${person.birthday}")
//    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date birthday;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    @Override
    public String toString() {
        return "User2Properties{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", hobbys=" + Arrays.toString(hobbys) +
                ", birthday=" + birthday +
                '}';
    }
}
